home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / python-support / gnome-games-data / gnome_sudoku / defaults.py < prev    next >
Encoding:
Python Source  |  2009-04-14  |  3.1 KB  |  72 lines

  1. # -*- coding: utf-8 -*-
  2. #
  3. # defaults.py.in sets many important default global variables
  4. # used throughout the game. Note that this file is processed by
  5. # automake to set prefix paths etc. Please keep defaults.py.in
  6. # in sync between glchess and gnome-sudoku. 
  7.  
  8. import sys, os, os.path
  9. import errno
  10. import gettext
  11.  
  12. root_dir = os.path.dirname(os.path.dirname(__file__))
  13. if not os.path.exists(os.path.join(root_dir, "Makefile.am")):
  14.     # Running in installed mode
  15.     APP_DATA_DIR = os.path.join('/usr', 'share') 
  16.     IMAGE_DIR = os.path.join(APP_DATA_DIR, 'pixmaps', 'gnome-sudoku')
  17.     LOCALEDIR = os.path.join(APP_DATA_DIR, 'locale')
  18.     GLADE_DIR = os.path.join(APP_DATA_DIR,'gnome-sudoku')
  19.     BASE_DIR = os.path.join(APP_DATA_DIR,'gnome-sudoku')
  20.     PUZZLE_DIR = os.path.join(APP_DATA_DIR,'gnome-sudoku','puzzles')    
  21. else:
  22.     # Running in uninstalled mode
  23.     sys.path.insert(0, os.path.abspath(root_dir))
  24.     APP_DATA_DIR = os.path.join(root_dir, '../data') 
  25.     IMAGE_DIR    = os.path.join(root_dir, '../images')
  26.     LOCALEDIR    = os.path.join(APP_DATA_DIR, 'locale')
  27.     GLADE_DIR    = os.path.join(root_dir, '../glade')
  28.     BASE_DIR     = os.path.join(root_dir, '../data')
  29.     PUZZLE_DIR   = BASE_DIR
  30.  
  31. DOMAIN = 'gnome-games'
  32. gettext.bindtextdomain(DOMAIN, LOCALEDIR)
  33. gettext.textdomain(DOMAIN)
  34. from gettext import gettext as _
  35. import gtk.glade
  36. gtk.glade.bindtextdomain (DOMAIN, LOCALEDIR)
  37. gtk.glade.textdomain (DOMAIN)
  38.  
  39. VERSION = "2.26.1"
  40. APPNAME = _("GNOME Sudoku")
  41. APPNAME_SHORT = _("Sudoku")
  42. COPYRIGHT = 'Copyright \xc2\xa9 2005-2008, Thomas M. Hinkle'
  43. DESCRIPTION = _('GNOME Sudoku is a simple sudoku generator and player. Sudoku is a japanese logic puzzle.\n\nGNOME Sudoku is a part of GNOME Games.')
  44. AUTHORS = ["Thomas M. Hinkle"]
  45. WEBSITE       = 'http://www.gnome.org/projects/gnome-games/'
  46. WEBSITE_LABEL = _('GNOME Games web site')
  47. AUTO_SAVE= True
  48. MIN_NEW_PUZZLES = 90
  49.  
  50. # The GPL license string will be translated, and the game name inserted.
  51. # This license is the same as in libgames-support/games-stock.c 
  52. LICENSE = [_("%s is free software; you can redistribute it and/or modify " 
  53.        "it under the terms of the GNU General Public License as published by " 
  54.        "the Free Software Foundation; either version 2 of the License, or " 
  55.        "(at your option) any later version.").replace("%s", APPNAME),
  56. _("%s is distributed in the hope that it will be useful, "
  57.        "but WITHOUT ANY WARRANTY; without even the implied warranty of "
  58.        "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the "
  59.        "GNU General Public License for more details.").replace("%s", APPNAME),
  60. _("You should have received a copy of the GNU General Public License "
  61.        "along with %s; if not, write to the Free Software Foundation, Inc., "
  62.        "51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA").replace("%s", APPNAME)]
  63.  
  64. DATA_DIR = os.path.expanduser('~/.gnome2/gnome-sudoku/')
  65.  
  66. def initialize_games_dir ():
  67.     try:
  68.         os.makedirs(DATA_DIR)
  69.     except OSError, e:
  70.         if e.errno != errno.EEXIST:
  71.             print _('Unable to make data directory %(dir)s: %(error)s') % {'dir': DATA_DIR, 'error': e.strerror}
  72.